<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <Parent></Parent>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
    <script>
        // 注册页面
        let Item = {
                data(){
                    return {}
                },
                template:"<p>Item</p>"
        }
        Vue.component("Parent",{
            data(){
                return {
                    message:"父组件"
                }
            },
            methods:{

            },
            components:{
                Item
            },
            template:'<div><Sub content="传递给子组件的数据">内容</Sub><Item></Item></div>'
        });
        Vue.component("Sub",{
            props:["content"],
            data(){
                return{

                }
            },
            template:`<p>子组件,{{content}},<slot></slot></p>`
        });
       
        let app = new Vue({
            el:"#app"
            
        });
    </script>
</body>
</html>